<?php

namespace app\common\model\user;

use think\Model;

class YearCard extends Model
{

    
    // 表名
    protected $table = 'year_card';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
    ];
    

    public function getScenicList()
    {  
       $scenicModel = new scenic();
       $scenic =  $scenicModel
                  ->where(['store_id'=>\think\Session::get('store.id'),'status'=>1,'category_id'=>13])
                  ->field('id,scenic_name')->select();
       $data =array_column($scenic,'scenic_name','id');
       return $data;
    }
    
    public function getStatusList()
    {
        return ['0' => __('Status 0'), '1' => __('Status 1')];
    }

    public function getAuditList()
    {
        return ['0'=>__('manual_audit 0'),'1'=>__('manual_audit 1')];
    }


    protected function setScenicidsAttr($value)
    {  
        return is_array($value) ? implode(',', $value) : $value;
    } 


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
